package com.hxd.otc.module.convenience.presenter;

import android.support.annotation.NonNull;

import com.hxd.otc.base.BaseBean;
import com.hxd.otc.module.convenience.bean.WaterCoalBillBean;
import com.hxd.otc.module.convenience.contract.PaymentInfoContract;
import com.hxd.otc.module.convenience.model.ConvenienceModel;
import com.hxd.otc.mvp.base.BasePresenter;
import com.hxd.otc.net.BaseObserver;

import java.util.ArrayList;

/**
 * 作  者 :  zjl
 * 时  间 :  2018/6/4 17:02
 * 描  述 :  ${所有订单页面}
 */
public class PaymentInfoPresenter extends BasePresenter<PaymentInfoContract.View> implements PaymentInfoContract.Presenter {

    ConvenienceModel model;


    public PaymentInfoPresenter(PaymentInfoContract.View view) {
        super(view);
        model = ConvenienceModel.getInstance();
    }

    @Override
    public void start() {


    }


    @Override
    public void onSubmit(String... parameters) {

        model.getArrearage(parameters[0], parameters[1], new BaseObserver<ArrayList<WaterCoalBillBean>>() {
            @Override
            public void onNext(@NonNull String msg, @NonNull ArrayList<WaterCoalBillBean> waterCoalBillBeans) {
                mView.onSuccess(waterCoalBillBeans.get(0));
            }

            @Override
            public void onError(int errType, @NonNull String errMessage) {
                mView.showToast(errMessage);
                mView.onError(errType);
            }
        }, mView.<BaseBean<ArrayList<WaterCoalBillBean>>>bindAutoDispose());

    }
}
